import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

import { resolve } from "path";
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "~": resolve(__dirname, "src"),
    },
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true, // 如果你需要使用less中的JavaScript功能
      },
    },
  },
  server: {
    proxy: {
      "/authority-mng": {
        target: "https://testacl.ahggwl.com",
        changeOrigin: true,
        rewrite(path) {
          return path.replace(/^\/authority-mng/, ""); // 路径重写
        },
      },
      "^/business-flow": {
        target: "https://testmessage.ahggwl.com",
        changeOrigin: true,
        rewrite(path) {
          return path.replace(/^\/business-flow/, ""); // 路径重写
        },
      },
    },
  },
});
